﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;

namespace SFJDManagement
{
    class ClassCase
    {
        public ClassCase()
        {
            Vehicles =new List<ClassVehicle>();
        }

        /// <summary>
        /// 委托人类
        /// </summary>
        public ClassBrigade Brigade
        {
            set;
            get;
        }

        /// <summary>
        /// 事故发生日期时间
        /// </summary>
        public DateTime Occurs
        {
            set;
            get;
        }

        /// <summary>
        /// 委托日期
        /// </summary>
        public string Commission
        {
            set;
            get;
        }

        /// <summary>
        /// 划号的日期时间
        /// </summary>
        public DateTime TimeGetNumber
        {
            set;
            get;
        }

        /// <summary>
        /// 联系人类
        /// </summary>
        public ClassContact Contact
        {
            set;
            get;
        }

        public Guid User
        {
            set;
            get;
        }

        /// <summary>
        /// 事故类型
        /// </summary>
        public int CaseType
        {
            set;
            get;
        }

        /// <summary>
        /// 事故车辆类
        /// </summary>
        public List<ClassVehicle> Vehicles
        {
            set;
            get;
        }

        //"2001SXAKAC20161010♠1♠a8c690ef-f56f-4798-bdad-08f619394280♠苏伟♠7903ca5b-216d-4777-b67b-f85ebb7a65b8♠2014-11-4 12:00:00♠2009-11-4 12:00:00♠陕A88888♣奔驰牌♣ML550♥陕A88888♣奔驰牌♣ML550"
        public string Coding2StringC2S()
        {
            string b = null;
            b += Brigade.Code + Occurs.GetDateTimeFormats('D')[1] + "♠";
            b += CaseType + "♠";
            b += Brigade.Guid.ToString() + "♠";
            b += Contact + "♠";
            b += User.ToString() + "♠";
            b += Occurs.ToString() + "♠";
            b += TimeGetNumber + "♠";
            string v = null;
            foreach(ClassVehicle veh in Vehicles)
            {
                v += veh.Coding2String('♣') + "♠";
            }
            b += v.Substring(0, v.Length - 1);
            return b;
        }
    }
}
